package com.jackiechan.day13;

import java.util.LinkedList;

public class Test_LinkedList {
    public static void main(String[] args) {
        show();
    }

    public static void show() {
        LinkedList<Integer> list = new LinkedList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.addLast(4);
        list.addFirst(5);
        System.out.println(list);
        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list.removeFirst());
        System.out.println(list.removeLast());

        System.out.println("**********");
        System.out.println(list);
        System.out.println(list.offerFirst(6));
        System.out.println(list.offerLast(7));
        System.out.println(list.peek());
        System.out.println(list.peekFirst());
        System.out.println(list.peekLast());
        System.out.println(list);
        System.out.println(list.poll());
        System.out.println(list);
        System.out.println(list.pollFirst());
        System.out.println(list);
        System.out.println(list.pollLast());
        System.out.println(list);
    }
}
